package edu.ustb.utils;

import java.util.Random;

/*
*  自动生成纯数字验证码
* */

public class MakeAuthCode {

    public static String getAuthCode(int number){
        /*
        * number: 要生成的验证码的位数
        * */
        String codeNum = "";
        int [] numbers = {0,1,2,3,4,5,6,7,8,9};
        Random random = new Random();
        for (int i = 0; i < number; i++) {
            //目的是产生足够随机的数，避免产生的数字重复率高的问题
            int next = random.nextInt(10000);
            // System.out.println(next);
            codeNum += numbers[next%10];
        }
        return codeNum;
    }

}
